package com.github.h4de5ing.kmp.rtk

import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.io.File

fun onChange(onChange: (String) -> Unit) {
    val writeFile = File("gps2.txt").readLines().toMutableList()
    MainScope().launch {
        var index = 0
        do {
            if (index >= writeFile.size) index = 0
            onChange(writeFile[index++])
            delay(100)
        } while (true)
    }
}